/*
 * Cell.fx
 *
 * Created on 21-mars-2010, 15:26:30
 */

package nc.jfxsudoku.customnode;

import javafx.scene.CustomNode;
import javafx.scene.Node;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import javafx.scene.Group;
import javafx.scene.text.Text;

/**
 * @author ncolboc
 */

def CELL_WIDTH  = 30;
def CELL_HEIGHT = CELL_WIDTH;

public class Cell extends CustomNode
{
    override protected function create () : Node
    {
        var cell = Group
        {
            content:
            [
                Rectangle
                {
                    x:CELL_WIDTH*row
                    y:CELL_HEIGHT*column
                    width:CELL_WIDTH
                    height:CELL_HEIGHT
                    fill:Color.WHITE
                    stroke:Color.GRAY
                    opacity:0.5
                },
                Text
                {
                    content:value.toString()
                    x:CELL_WIDTH*row + (CELL_WIDTH/2)
                    y:CELL_HEIGHT*column + (CELL_HEIGHT/2)
                }
            ]
        }

        return cell;
    }

    public var row:Integer;
    public var column:Integer;
    public var value:Integer;
}
